#pragma once

#include <Network/TcpIoLoop.h>
#include <Network/TcpConnection.h>

struct TcpPacket;
class TcpClient
{
public:
	TcpClient(TcpIoLoop& ioLoop, TcpConnectionEventHandler* eventHandler);
	~TcpClient(void);

	void Start(std::string& ip, std::string& port);
	void Stop();

	TcpConnection* GetConnection() { return connection_; }
	
	void OnConnectCompleted(const boost::system::error_code& error);

private:
	TcpConnection* connection_;
	TcpIoLoop& ioLoop_;
	TcpConnectionEventHandler* eventHandler_;

	std::shared_ptr<boost::asio::ip::tcp::socket> socketPtr_;
};
